var __extends = this.__extends || function (d, b) {
    function __() { this.constructor = d; }
    __.prototype = b.prototype;
    d.prototype = new __();
};
var Project = (function (_super) {
    __extends(Project, _super);
    function Project() {
        _super.apply(this, arguments);

    }
    Project.prototype.Ready = function () {
        this.setUpWall(this.aUrl[5]);
        $.getJSON(this.aUrl[0] + '/' + this.options.ProjectID, {
        }, function (data) {
            if(data) {
                var newItem = data[0].WorkItemClasses;
                var keyClassHelpers = new Array("wiListTodo", "wiListInProgress", "wiListDone");
                for(var i = 0; i < 3; i++) {
                    var key = {
                        KeyClassHelper: keyClassHelpers[i],
                        Name: newItem[0],
                        Count: newItem[1]
                    };
                    $("#projectIndicators").append($("#projectindicatorTemplate").render(key));
                }
            }
        });
        loadAjaxHtml("checkedoutlist", this.aUrl[3] + '/' + this.options.ProjectID + "/?t=0", 'none');
    };
    Project.prototype.setUpWall = function (url) {
        var t = $("#walluserlist");
        t.setTemplate($("#WallListBodyTemplate").html());
        t.processTemplateStart(url, null, 120000, {
            id: this.options.ProjectID,
            Last: 20
        }, {
            on_success: Base.Page.Self.CBRefreshWall()
        });
    };
    Project.prototype.CBRefreshWall = function () {
        $(".WCDC").button({
            icons: {
                primary: "ui-icon-trash"
            },
            text: false
        });
        $('abbr.timeago').timeago();
    };
    Project.prototype.EditDialogComplete = function () {
        $('#dialog-comments').dialog('close');
    };
    Project.prototype.OpenUpdProject = function () {
        $('#dialog-comments').dialog({
            autoOpen: false,
            width: 500,
            modal: true,
            hide: "highlight",
            buttons: {
                Cancel: function () {
                    $(this).dialog("close");
                },
                "Save": function () {
                    $("#projectForm").submit();
                }
            }
        }).dialog('open');
    };
    return Project;
})(Base.Page);
